﻿CREATE PROCEDURE [dbo].[proc_Assets_Names_Getlist]
	(
		@CategoryId int
	)
AS
	
	;WITH list as (Select ROW_NUMBER() OVER (ORDER BY Sort)AS Row,
	Id,
	CategoryId,
	(Select Title From Assets_Categorys Where Id=Assets_Names.CategoryId) As CategoryName,
	GId,
	Title,
	Sort
,(case isnull(typeid,0) when 1 then '固定公用类' when 2 then '分配使用类' when 3 then '耗材低值类' else ''  end) as typename

	From Assets_Names Where (@CategoryId=0 Or CategoryId=@CategoryId) and CategoryId>0
	)
	Select * From list
	RETURN
